First thing we need to do is to import the msJ package.
using msJ
We will use the same data set as in Example 1
using HTTP
data = download("https://raw.githubusercontent.com/ajgiuliani/msJ.jl/master/test/test.mzXML",
"~/Downloads/test.mzXML") ;
Now, using the info function of the msJpackage, we will see what is inside the file
info(data)
s = load(data) ;
Getting chromatograms is straightforward using the chromatogram method.
We load the entiere chromatogram like this:
full_TIC = chromatogram(s)
We may also filter the data to first MS level:
MS1_TIC = chromatogram(s, msJ.Level(1))
Or we may get only the mass spectrometry data which have been aquirred under CID conditions:
CID_TIC = chromatogram(s, msJ.Activation_Method("CID"))
We can also extract the chromatogram for a specific precursor ion:
mz902_TIC = chromatogram(s, msJ.Precursor(902.33))
Let plot the chromatograms, using theGR backend:
using Plots
gr()
A recipe has also been defined for chromatogram data.
gr()
p1 = plot(full_TIC, label = "full tic")
p2 = plot(MS1_TIC, label = " MS1_TIC")
p3 = plot(CID_TIC, label = "CID_TIC")
p4 = plot(mz902_TIC, label = "mz902_TIC")
p = plot(p1, p2, p3, p4, layout = (4,1), size = (500,500))
Plots made using GR() may be saved to a file:
savefig(p, "~/Downloads/temp.png")
Average mass spectra may be obtained using the proper msfilter functions:
ms1 = msJ.average(s, msJ.Level(1)) # MS1 scans
ms2_CID = msJ.average(s, msJ.Activation_Method("CID")) # CID scans
ms2_PQD = msJ.average(s, msJ.Activation_Method("PQD")) # PQD scans
ms2_1255 = msJ.average(s, msJ.Precursor(1255.5)); # Precursor m/z = 1255.5 scans
Mass spectra may be plotted the same way as chromatograms:
plotly()
p5 = plot(ms1, label = "MS", color = :blue)
p6 = plot(ms2_CID, label = "CID", color = :green)
p7 = plot(ms2_PQD, label = "PQD", color = :purple)
p8 = plot(ms2_1255, label = "mz 1255", color = :orange)
plot(p5, p6, p7, p8, layout = (4,1), size = (800,600))